package com.howbuy.tms;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;


@SpringBootApplication
public class TmsGatewayApplication {

    public static void main(String[] args) {
        SpringApplication.run(TmsGatewayApplication.class, args);
    }

    /**
     * spring cloud gateway 配置方式1.启动主程序配置，2.通过配置文件配置
     * @param builder
     * @return
     */
    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
       return builder.routes()
             .route(r -> r.path("/fund/**")
                      .and()
                      .uri("http://www.howbuy.com/"))
             .build();
    }

}
